package com.tanhua.autoconfig.properties;

import com.baidu.aip.face.AipFace;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;

@ConfigurationProperties(prefix = "tanhua.aip")
public class AipProperties {
    private String appid;
    private String apikey;
    private String secretkey;

    public AipProperties() {
    }

    public AipProperties(String appid, String apikey, String secretkey) {
        this.appid = appid;
        this.apikey = apikey;
        this.secretkey = secretkey;
    }


    @Bean
    public AipFace aipFace() {
        AipFace client = new AipFace(appid, apikey, secretkey);

        // 可选：设置网络连接参数
        client.setConnectionTimeoutInMillis(2000);
        client.setSocketTimeoutInMillis(60000);
        return client;
    }


    /**
     * 获取
     * @return appid
     */
    public String getAppid() {
        return appid;
    }

    /**
     * 设置
     * @param appid
     */
    public void setAppid(String appid) {
        this.appid = appid;
    }

    /**
     * 获取
     * @return apikey
     */
    public String getApikey() {
        return apikey;
    }

    /**
     * 设置
     * @param apikey
     */
    public void setApikey(String apikey) {
        this.apikey = apikey;
    }

    /**
     * 获取
     * @return secretkey
     */
    public String getSecretkey() {
        return secretkey;
    }

    /**
     * 设置
     * @param secretkey
     */
    public void setSecretkey(String secretkey) {
        this.secretkey = secretkey;
    }

    public String toString() {
        return "AipProperties{appid = " + appid + ", apikey = " + apikey + ", secretkey = " + secretkey + "}";
    }
}
